home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xa / BatchProcessor$PrintDiagramCommand.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  3.8 KB  |  105 lines

  1. package com.extensibility.xa;
  2.  
  3. import com.extensibility.app.Desktop;
  4. import com.extensibility.app.DialogFactory;
  5. import com.extensibility.rock.diagram.Diagram;
  6. import com.extensibility.xml.ElementDeclaration;
  7. import com.extensibility.xml.URI;
  8. import java.io.File;
  9. import java.io.IOException;
  10.  
  11. public class BatchProcessor$PrintDiagramCommand implements BatchProcessor.BatchCommand {
  12.    // $FF: synthetic field
  13.    final BatchProcessor this$0;
  14.    String declName;
  15.    String expand;
  16.    String imgName;
  17.    URI schemaUri;
  18.  
  19.    public BatchProcessor$PrintDiagramCommand(BatchProcessor var1, String var2, String var3, String var4, String var5) {
  20.       this.this$0 = var1;
  21.       this.declName = var2;
  22.       if (var3 != null && var3.length() != 0) {
  23.          this.expand = var3;
  24.       } else {
  25.          this.expand = "true";
  26.       }
  27.  
  28.       this.imgName = var4;
  29.       if (var5 != null) {
  30.          this.schemaUri = new URI((URI)null, var5);
  31.       } else {
  32.          this.schemaUri = XADesktop.getFrontSchemaWindow().getSchemaDoc().getURI();
  33.       }
  34.  
  35.    }
  36.  
  37.    public BatchProcessor$PrintDiagramCommand(BatchProcessor var1) {
  38.       this.this$0 = var1;
  39.       this.declName = null;
  40.       this.expand = null;
  41.       this.imgName = null;
  42.       this.schemaUri = null;
  43.    }
  44.  
  45.    public synchronized boolean doCommand() throws InterruptedException {
  46.       Object var1 = null;
  47.       if (this.schemaUri == null) {
  48.          DialogFactory.stop(Desktop.getFrontDocWindow(), String.valueOf("You need to specify a valid URI for searching ").concat(String.valueOf(this.declName)));
  49.          return false;
  50.       } else {
  51.          SchemaDoc var8 = (SchemaDoc)this.this$0.isDocAddedToDesktop(this.schemaUri);
  52.          if (var8 == null) {
  53.             DialogFactory.stop(Desktop.getFrontDocWindow(), String.valueOf(this.schemaUri.getShortName()).concat(String.valueOf(" hasn't opened yet!")));
  54.             return false;
  55.          } else {
  56.             ElementDiagram var2 = new ElementDiagram(new ElementDiagramModel(var8));
  57.             ElementDeclaration var3 = var8.getNamedElement(this.declName);
  58.             if (var3 == null) {
  59.                DialogFactory.stop(Desktop.getFrontDocWindow(), String.valueOf(String.valueOf(this.declName).concat(String.valueOf(" does not exist in "))).concat(String.valueOf(this.schemaUri.getShortName())));
  60.                return false;
  61.             } else {
  62.                ((Diagram)var2).getModel().setRoot(var3);
  63.                boolean var4;
  64.                if (this.expand.equals("true")) {
  65.                   var4 = true;
  66.                } else {
  67.                   var4 = false;
  68.                }
  69.  
  70.                ((Diagram)var2).getDataModel().expandNode(((Diagram)var2).getDataModel().getRoot(), var4);
  71.                ((Diagram)var2).rerender();
  72.  
  73.                try {
  74.                   if (this.imgName != null && this.imgName.length() != 0) {
  75.                      File var9 = new File(this.imgName);
  76.                      SchemaWin.exportDiagramAsImage(var9, var2);
  77.                      return true;
  78.                   } else {
  79.                      DialogFactory.stop(Desktop.getFrontDocWindow(), String.valueOf("You need to supply a valid output image file name for declaration ").concat(String.valueOf(this.declName)));
  80.                      boolean var5 = false;
  81.                      return var5;
  82.                   }
  83.                } catch (IOException var7) {
  84.                   DialogFactory.showException(Desktop.getFrontDocWindow(), 131, var7);
  85.                   boolean var6 = false;
  86.                   return var6;
  87.                }
  88.             }
  89.          }
  90.       }
  91.    }
  92.  
  93.    public void setDeclName(String var1) {
  94.       this.declName = var1;
  95.    }
  96.  
  97.    public void setExpand(String var1) {
  98.       this.expand = var1;
  99.    }
  100.  
  101.    public void setImageFileName(String var1) {
  102.       this.imgName = var1;
  103.    }
  104. }
  105.